// todo 创建路由  配置路由规则  导出路由实例对象

// 导入页面
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'
import Play from '@/views/Play'
//导入
import Vue from 'vue'
import VueRouter from 'vue-router'
//注册
Vue.use(VueRouter)
//配置路由规则
const routes =[
  {
    path:'/',
    component:Layout
  },
  {
    path:'/layout',
    component:Layout,
    //重定向
    redirect: '/layout/home',
    children:[
      //设置挂载点
      {
        path:'home',
        component:Home,
        meta: { 
          title:'首页'
         }
      },
      {
        path:'search',
        component:Search,
        meta: { 
          title:'搜索'
         }
      },
      
    ]
  },
  {
    path:'/play',
    component:Play
  }
]
//
const router = new VueRouter({
  routes
})
//导出
  export default router